package cn.iocoder.yudao.module.enterprise.dal.mysql.praxisProject;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.enterprise.controller.admin.praxisProject.vo.*;
import cn.iocoder.yudao.module.enterprise.dal.dataobject.praxisProject.EnterpriseProjectDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 实践项目 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface EnterpriseProjectMapper extends BaseMapperX<EnterpriseProjectDO> {

    Integer getProjectCountByTitle(@Param("title") String title,@Param("id")  Long id);

    default PageResult<EnterpriseProjectDO> selectPage(EnterpriseProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseProjectDO>()
                .eqIfPresent(EnterpriseProjectDO::getTitle, reqVO.getTitle())
                .eqIfPresent(EnterpriseProjectDO::getExamineFlag, reqVO.getExamineFlag())
                .eqIfPresent(EnterpriseProjectDO::getExamineStatus, reqVO.getExamineStatus())
                .orderByDesc(EnterpriseProjectDO::getWeight));
    }

    default List<EnterpriseProjectDO> selectList(EnterpriseProjectPageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<EnterpriseProjectDO>()
                .eqIfPresent(EnterpriseProjectDO::getTitle, reqVO.getTitle())
                .eqIfPresent(EnterpriseProjectDO::getExamineFlag, reqVO.getExamineFlag())
                .eqIfPresent(EnterpriseProjectDO::getExamineStatus, reqVO.getExamineStatus())
                .orderByDesc(EnterpriseProjectDO::getWeight ));
    }
    List<EnterpriseProjectPageRespVO> getPraxisProjectPage(IPage page, @Param("params") Map<String, Object> params);

    List<EnterpriseProjectPageRespVO> getPraxisProjectList(@Param("title") String title,@Param("companyId") Long companyId,@Param("queryType") Integer queryType);

    EnterpriseProjectDO getProjectInfoById(@Param("id") Long id);

    void revertPraxisProject(@Param("id") Long id);

    @TenantIgnore
    Integer getMaxWeight(@Param("projectTypeId") Long projectTypeId);

    EnterpriseProjectCountVO getPraxisProjectCount(@Param("id") Long id);

    List<EnterpriseProjectViewCountVO> getPraxisProjectViewCount(@Param("id") Long id,@Param("list") List<String> list);

    List<EnterpriseProjectViewCountVO> getPraxisProjectMajorCount(@Param("id") Long id );
}
